import api from '../../../fetch/api'

export default {
    data() {
        return {
            bigImgPath: ''
        }
    },
    created() {
        this.getItemList();
    },
    methods: {
        getList() {
            let params = $.extend({}, this.searchParams, this.otherParams);
            console.log('this.otherParams', this.otherParams)
            this.getItemList(params);
        },
        showBigImgModal(name, path) {
            this.bigImgPath = path;
            this.toOpenImgModal(name, path);
        },
        
        //获取列表
        getItemList(aparams) {
            let self = this,
                params = {
                    page: this.pageNumber,
                    rp: this.pageSize
                };
            params = $.extend({}, params, aparams);
            // API.coupon.GetTraderListData(params)
            api.fetchGet('/parkingBaseData/list.do', params)
                .then(res => {
                    console.log('getListResult', res)
                    let data = res.data,
                        list = data.rows;
                    self.tbodysInfo = list;
                    self.total = data.total;
                }, err => { })
        },

        toBatchOprators(name, data) {
            switch (name) {
                case 'bt_correct': this.toAdjust(data); break;
                default: break;
            }
        },
        toAdjust() { },
        exportData() {
            let self = this;
            let params = {
            };
            params = $.extend({}, params, this.searchParams,this.otherParams);
            this.toExport('parkingBaseData/export.do', params);
        },
        openVems(parkCode){
            let params = {
                parkCode:parkCode
            };
            api.fetchGet('/parkingBaseData/getVemsUrl.do', params)
            .then(res => {
                let data = res.data;
                if(res.status==1){
                    var a = $("<a href='"+data+"' target='_blank' >open</a>").get(0);
                    var e = document.createEvent('MouseEvents');
                    e.initEvent('click', true, true);
                    a.dispatchEvent(e);
                }
            }, err => { })
        }
    }
}